package com.example.yunnan.service;

import com.example.yunnan.dao.loginuserDao;
import com.example.yunnan.pojo.user;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class loginuserservice {
    @Autowired
    loginuserDao loginuserDao;

    public boolean isExist(String username) {
        user user = getByName(username);
        return null!=user;
    }

    public user getByName(String username) {
        return loginuserDao.findByUsername(username);
    }

    public user get(String username, String password){
        return loginuserDao.getByUsernameAndPassword(username, password);
    }

    public void add(user user) {
        loginuserDao.save(user);
    }



}
